package com.gt.aep.base.service.systemManage;

import com.gt.aep.base.dao.systemManage.SysIdentityRoleDao;
import com.gt.aep.base.entity.systemManage.SysIdentityRole;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysIdentityRoleService {

    @Autowired
    SysIdentityRoleDao sysIdentityRoleDao;

    /**
     * 新增身份角色
     * @param sysIdentityRole
     * @return
     */
    public int insert(SysIdentityRole sysIdentityRole){
        return sysIdentityRoleDao.insert(sysIdentityRole);
    }

    /**
     * 修改身份角色信息
     * @param sysIdentityRole
     * @return
     */
    public int update(SysIdentityRole sysIdentityRole){
        return sysIdentityRoleDao.update(sysIdentityRole);
    }

    /**
     * 批量删除身份角色
     * @param ids
     * @return
     */
    public int delete(String[] ids){
        return sysIdentityRoleDao.delete(ids);
    }

    /**
     * 根据身份角色信息获取相关身份角色列表
     * @param sysIdentityRole
     * @return
     */
    public List<SysIdentityRole> getList(SysIdentityRole sysIdentityRole){
        return sysIdentityRoleDao.getList(sysIdentityRole);
    }

    /**
     * 根据身份角色信息获取相关身份角色个数
     * @param sysIdentityRole
     * @return
     */
    public int getCount(SysIdentityRole sysIdentityRole){
        return sysIdentityRoleDao.getCount(sysIdentityRole);
    }

    /**
     * 根据是否角色名称查询
     * @param roleName
     * @return
     */
    public int getRoleCountByName(String roleName) {
        return sysIdentityRoleDao.getRoleCountByName(roleName);
    }

    /**
     * 清楚 userId 相关的记录
     * @param userId
     * @return
     */
    public int deleteByUid(String userId) {
        return sysIdentityRoleDao.deleteByUid(userId);
    }

    /**
     * 清楚 identityRoleId 相关的记录
     * @param identityRoleId
     * @return
     */
    public int deleteByIdentityRoleId(String identityRoleId) {
        return sysIdentityRoleDao.deleteByIdentityRoleId(identityRoleId);
    }
}
